package com.test.kubernets.controller;


import com.github.pagehelper.PageInfo;
import com.test.kubernets.dto.UserQueryDto;
import com.test.kubernets.service.UserControllerClient;
import com.test.kubernets.util.wrapper.WrapMapper;
import com.test.kubernets.util.wrapper.Wrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * bff
 */
@RestController
@RequestMapping("/sysUser")
@Validated
@Slf4j
@Api(value = "系统用户API", tags = "systemapi")
public class SysUserController {

    @Autowired
    private UserControllerClient userControllerClient;

    /**
     * 用户信息列表数据
     * @param userQueryDto
     * @return
     */
    @RequestMapping(value = "/findUserPage", method = RequestMethod.POST)
    @ApiOperation(value = "用户信息列表数据",response = PageInfo.class)
    public Object findSchoolsInConditionPaging(@Validated @RequestBody UserQueryDto userQueryDto) {
        try {
            Wrapper wrapper = userControllerClient.queryListPage(userQueryDto);
            return WrapMapper.ok(wrapper.getResult());
        } catch (Exception e) {
            log.info("访问用户信息列表数据时发生异常：{}",e.getMessage());
            return WrapMapper.error(e.getMessage());
        }
    }

}
